package cays.student.controller;

import cays.student.service.ScService;
import cays.student.vo.ResultVO;
import cays.student.vo.Sc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 选课信息控制类
 *
 * @author Chai yansheng
 * @create 2019/8/30
 **/
@RestController
@RequestMapping("/sc")
public class ScController {
    @Autowired
    private ScService scService;
    @GetMapping("/get/{sno}/{cno}")
    ResultVO getScBySnoAndCno(@PathVariable("sno") String sno, @PathVariable("cno") String cno) {
        return new ResultVO("0", scService.getScBySnoAndCno(sno, cno));
    }

    @GetMapping("/list")
    ResultVO getAllSc() {
        return new ResultVO("0", scService.getAllSc());
    }

    @PostMapping("/update")
    ResultVO updateScBySnoAndCno(@RequestBody Sc sc) {
        return new ResultVO("0", scService.updateScBySnoAndCno(sc));
    }

    @PostMapping("/insert")
    ResultVO insertSc(@RequestBody Sc sc) {
        return new ResultVO("0", scService.insertSc(sc));
    }

    @GetMapping("/delete/{sno}/{cno}")
    ResultVO deleteScBySnoAndCno(@PathVariable("sno") String sno, @PathVariable("cno") String cno) {
        return new ResultVO("0", scService.deleteScBySnoAndCno(sno, cno));
    }
}
